package leetcode.LinkList;

public class commonPart {
    public static void main(String[] args) {

    }
    public static void process(Node head1,Node head2) {
        if (head1 == null || head2 == null) {
            return;
        }

        while (head1 != null || head2 != null) {
            if (head1.value == head2.value) {
                System.out.println(head1.value);
                head1 = head1.next;
                head2 = head2.next;
            } else if (head1.value > head2.value) {
                head2 = head2.next;
            } else {
                head1 = head1.next;
            }
        }
    }
}
